﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CoolERP_BLL;
using CoolERP_Entities;

namespace CoolERP_Web.User
{
    public partial class SKDXQ : BasePage
    {
        private Guid SKDID
        {
            get { return this.GetUrlParam("id") == null ? Guid.Empty : new Guid(this.GetUrlParam("id").ToString()); }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                BindData();
        }

        private void BindData()
        {
            using (CW_SKDBLL xBLL = new CW_SKDBLL())
            {
                Dictionary<string, string> dc = new Dictionary<string, string>();
                dc.Add("ID", SKDID.ToString());
                int RecordCount = 0;
                SKDModel entity = xBLL.QuerySKD(dc, "", null, 1, out RecordCount).FirstOrDefault();
                if (entity != null)
                {
                    liBH.Text = entity.BH.ToString();
                    liJBRName.Text = entity.JBRName;
                    liDZRQ.Text = entity.DZRQ.ToString("yyyy-MM-dd HH:mm");
                    liZPHM.Text = entity.ZPHM.ToString();
                    liSSJE.Text = Convert.ToDouble(entity.SSJE).ToString();
                    liSRYH.Text = entity.SRYHMC;
                    liMoney.Text = entity.SSJE.ToString();
                    liHB.Text = "元";
                }
            }
            using (CW_SKD_FPBBLL cBLL = new CW_SKD_FPBBLL())
            {
                List<CW_SKD_FPBModel> mxbs = cBLL.GetSKDXQ(SKDID);
                GridView1.DataSource = mxbs;
                GridView1.DataBind();
            }
        }
    }
}